.class public Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;
.super Lcom/esfile/screen/recorder/videos/edit/activities/caption/font/AutoFitTextView;
.source "PieceView.java"


# instance fields
.field private g:Landroid/graphics/drawable/Drawable;

.field private h:Landroid/graphics/drawable/Drawable;

.field private i:Landroid/graphics/drawable/Drawable;

.field private j:Landroid/graphics/drawable/Drawable;

.field private k:Landroid/graphics/Rect;

.field private l:Landroid/graphics/Paint;

.field private m:Landroid/graphics/Paint;

.field private n:I

.field private o:I

.field private p:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/font/AutoFitTextView;-><init>(Landroid/content/Context;)V

    const/16 p1, 0x14

    .line 2
    iput p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->n:I

    mul-int/lit8 p1, p1, 0x2

    .line 3
    iput p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->p:I

    .line 4
    invoke-direct {p0}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->a()V

    return-void
.end method

.method public static a(Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;
    .locals 1

    .line 17
    instance-of v0, p0, Landroid/graphics/drawable/BitmapDrawable;

    if-eqz v0, :cond_0

    .line 18
    check-cast p0, Landroid/graphics/drawable/BitmapDrawable;

    invoke-virtual {p0}, Landroid/graphics/drawable/BitmapDrawable;->getBitmap()Landroid/graphics/Bitmap;

    move-result-object p0

    return-object p0

    :cond_0
    const/4 p0, 0x0

    return-object p0
.end method

.method private a()V
    .locals 1

    .line 1
    invoke-virtual {p0}, Landroid/widget/TextView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->a(Landroid/content/Context;)V

    .line 2
    invoke-direct {p0}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->b()V

    return-void
.end method

.method private a(Landroid/content/Context;)V
    .locals 2

    .line 3
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    .line 4
    sget v1, Les/w4;->durec_cut_rangebar_cursor_press:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    iput-object v1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->g:Landroid/graphics/drawable/Drawable;

    .line 5
    sget v1, Les/w4;->durec_cut_rangebar_cursor_press:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->h:Landroid/graphics/drawable/Drawable;

    .line 6
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    sget v1, Les/v4;->durec_caption_multi_track_piece_slide_width:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v0

    iput v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->n:I

    .line 7
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object p1

    sget v0, Les/v4;->durec_caption_multi_track_piece_padding:I

    invoke-virtual {p1, v0}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result p1

    iput p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->o:I

    .line 8
    iget-object p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->g:Landroid/graphics/drawable/Drawable;

    iput-object p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->i:Landroid/graphics/drawable/Drawable;

    .line 9
    iput-object p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->j:Landroid/graphics/drawable/Drawable;

    .line 10
    new-instance p1, Landroid/graphics/Rect;

    invoke-direct {p1}, Landroid/graphics/Rect;-><init>()V

    iput-object p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->k:Landroid/graphics/Rect;

    .line 11
    sget p1, Les/u4;->durec_caption_piece_normal_bg_color:I

    invoke-virtual {p0, p1}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->setBarColor(I)V

    const/16 p1, 0x10

    .line 12
    invoke-virtual {p0, p1}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/font/AutoFitTextView;->setFitMode(I)V

    .line 13
    iget p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->n:I

    iget v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->o:I

    add-int v1, p1, v0

    add-int/2addr p1, v0

    invoke-virtual {p0, v1, v0, p1, v0}, Landroid/widget/TextView;->setPadding(IIII)V

    const p1, 0x800013

    .line 14
    invoke-virtual {p0, p1}, Landroid/widget/TextView;->setGravity(I)V

    const/4 p1, 0x1

    .line 15
    invoke-virtual {p0, p1}, Landroid/widget/TextView;->setMaxLines(I)V

    .line 16
    sget-object p1, Landroid/text/TextUtils$TruncateAt;->END:Landroid/text/TextUtils$TruncateAt;

    invoke-virtual {p0, p1}, Landroid/widget/TextView;->setEllipsize(Landroid/text/TextUtils$TruncateAt;)V

    return-void
.end method

.method private b()V
    .locals 3

    .line 1
    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->m:Landroid/graphics/Paint;

    const/4 v1, 0x1

    .line 2
    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 3
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->m:Landroid/graphics/Paint;

    sget-object v2, Landroid/graphics/Paint$Style;->FILL:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v2}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    .line 4
    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->l:Landroid/graphics/Paint;

    .line 5
    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 6
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->l:Landroid/graphics/Paint;

    const/high16 v1, 0x3f800000    # 1.0f

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    .line 7
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->l:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Style;->STROKE:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    .line 8
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->l:Landroid/graphics/Paint;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    return-void
.end method


# virtual methods
.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 14

    .line 1
    invoke-super {p0, p1}, Landroid/widget/TextView;->onDraw(Landroid/graphics/Canvas;)V

    .line 2
    invoke-virtual {p0}, Landroid/widget/TextView;->getWidth()I

    move-result v0

    .line 3
    invoke-virtual {p0}, Landroid/widget/TextView;->getHeight()I

    move-result v1

    .line 4
    iget v2, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->n:I

    .line 5
    invoke-virtual {p0}, Landroid/widget/TextView;->getWidth()I

    move-result v3

    iget v4, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->n:I

    sub-int/2addr v3, v4

    .line 6
    iget-object v4, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->k:Landroid/graphics/Rect;

    const/4 v5, 0x0

    iput v5, v4, Landroid/graphics/Rect;->left:I

    .line 7
    iput v5, v4, Landroid/graphics/Rect;->top:I

    .line 8
    iput v2, v4, Landroid/graphics/Rect;->right:I

    .line 9
    iput v1, v4, Landroid/graphics/Rect;->bottom:I

    .line 10
    iget-object v2, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->i:Landroid/graphics/drawable/Drawable;

    invoke-static {v2}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->a(Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;

    move-result-object v2

    iget-object v4, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->k:Landroid/graphics/Rect;

    iget-object v6, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->m:Landroid/graphics/Paint;

    const/4 v7, 0x0

    invoke-virtual {p1, v2, v7, v4, v6}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    .line 11
    iget-object v2, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->k:Landroid/graphics/Rect;

    iput v3, v2, Landroid/graphics/Rect;->left:I

    .line 12
    iput v5, v2, Landroid/graphics/Rect;->top:I

    .line 13
    iput v0, v2, Landroid/graphics/Rect;->right:I

    .line 14
    iput v1, v2, Landroid/graphics/Rect;->bottom:I

    .line 15
    iget-object v2, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->j:Landroid/graphics/drawable/Drawable;

    invoke-static {v2}, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->a(Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;

    move-result-object v2

    iget-object v3, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->k:Landroid/graphics/Rect;

    iget-object v4, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->m:Landroid/graphics/Paint;

    invoke-virtual {p1, v2, v7, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    int-to-float v10, v5

    int-to-float v11, v0

    int-to-float v12, v1

    .line 16
    iget-object v13, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->l:Landroid/graphics/Paint;

    move-object v8, p1

    move v9, v10

    invoke-virtual/range {v8 .. v13}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 3

    .line 1
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    .line 2
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v1

    if-eqz v0, :cond_2

    const/4 v2, 0x1

    if-eq v0, v2, :cond_0

    const/4 v2, 0x3

    if-eq v0, v2, :cond_0

    const/4 v2, 0x5

    if-eq v0, v2, :cond_2

    const/4 v2, 0x6

    if-eq v0, v2, :cond_0

    goto :goto_0

    .line 3
    :cond_0
    iget v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->p:I

    int-to-float v0, v0

    cmpg-float v0, v1, v0

    if-gez v0, :cond_1

    .line 4
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->g:Landroid/graphics/drawable/Drawable;

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->i:Landroid/graphics/drawable/Drawable;

    goto :goto_0

    .line 5
    :cond_1
    invoke-virtual {p0}, Landroid/widget/TextView;->getWidth()I

    move-result v0

    iget v2, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->p:I

    sub-int/2addr v0, v2

    int-to-float v0, v0

    cmpl-float v0, v1, v0

    if-lez v0, :cond_4

    .line 6
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->g:Landroid/graphics/drawable/Drawable;

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->j:Landroid/graphics/drawable/Drawable;

    goto :goto_0

    .line 7
    :cond_2
    iget v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->p:I

    int-to-float v0, v0

    cmpg-float v0, v1, v0

    if-gez v0, :cond_3

    .line 8
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->h:Landroid/graphics/drawable/Drawable;

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->i:Landroid/graphics/drawable/Drawable;

    goto :goto_0

    .line 9
    :cond_3
    invoke-virtual {p0}, Landroid/widget/TextView;->getWidth()I

    move-result v0

    iget v2, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->p:I

    sub-int/2addr v0, v2

    int-to-float v0, v0

    cmpl-float v0, v1, v0

    if-lez v0, :cond_4

    .line 10
    iget-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->h:Landroid/graphics/drawable/Drawable;

    iput-object v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->j:Landroid/graphics/drawable/Drawable;

    .line 11
    :cond_4
    :goto_0
    invoke-super {p0, p1}, Landroid/widget/TextView;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result p1

    return p1
.end method

.method public setBarColor(I)V
    .locals 1
    .param p1    # I
        .annotation build Landroidx/annotation/ColorRes;
        .end annotation
    .end param

    .line 1
    invoke-virtual {p0}, Landroid/widget/TextView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0, p1}, Landroidx/core/content/ContextCompat;->getColor(Landroid/content/Context;I)I

    move-result p1

    invoke-virtual {p0, p1}, Landroid/widget/TextView;->setBackgroundColor(I)V

    .line 2
    invoke-virtual {p0}, Landroid/widget/TextView;->invalidate()V

    return-void
.end method

.method public setSlideWidth(I)V
    .locals 2

    .line 1
    div-int/lit8 v0, p1, 0x2

    iput v0, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->n:I

    .line 2
    iput p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->p:I

    .line 3
    iget p1, p0, Lcom/esfile/screen/recorder/videos/edit/activities/caption/multitrack/PieceView;->o:I

    add-int v1, v0, p1

    add-int/2addr v0, p1

    invoke-virtual {p0, v1, p1, v0, p1}, Landroid/widget/TextView;->setPadding(IIII)V

    return-void
.end method
